package speculoos.jndi;

import javax.naming.Name;
import javax.naming.NameParser;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;

/**
 * Interface for the JNDI Connection.
 * Used in place of DirContext.
 * @author trecloux
 */
public interface JNDIConnection {

	/** @see javax.naming.Context#getNameInNamespace() */
	String getNameInNamespace() throws NamingException;

	/** @see javax.naming.Context#getNameParser(String) */
	NameParser getNameParser(String directoryName) throws NamingException;

	/** @see javax.naming.directory.DirContext#createSubcontext(Name, Attributes) */
	void createSubcontext(Name name, Attributes attrs) throws NamingException;

	/** @see javax.naming.directory.DirContext#search(String, String, SearchControls) */
	NamingEnumeration search(Name name, String _filter, SearchControls controls) throws NamingException;

	/** @see javax.naming.Context#destroySubcontext(Name) */
	void destroySubcontext(Name name) throws NamingException;

	/** @see javax.naming.directory.DirContext#modifyAttributes(Name, ModificationItem[]) */
	void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException;

	/** @see javax.naming.Context#rename(Name, Name) */
	void rename(Name name, Name newName) throws NamingException;

	/** @see javax.naming.directory.DirContext#getAttributes(Name, String[]) */
	Attributes getAttributes(Name name, String[] returningAttributes) throws NamingException;

	/** Close or releases the connection */
	void close();

	
}
